package cn.weakup.string;

/**
 * @author Dawn
 * @version 1.0.0
 * @desc
 * @date 2022/5/16
 */
public class StringTest {

    public static void main(String[] args) {
        String a = "string";

        System.out.println(a.charAt(2));
        // 返回对应位置的Unicode编码
        System.out.println(a.codePointAt(2));
        // 返回前一个的Unicode编码
        System.out.println(a.codePointBefore(2));

        StringBuffer sb = new StringBuffer("string");
        System.out.println(a.contentEquals(sb));

        StringBuilder sbuilder = new StringBuilder("string");
        System.out.println(a.contentEquals(sbuilder));
        System.out.println(sb.deleteCharAt(sb.length()-1));

        System.out.println(a.hashCode() + " | " + sb.hashCode() + " | " + sbuilder.hashCode());
    }
}
